#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
#include <QLabel>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_add_clicked()
{
    int index = ui->tabWidget->count();
    //qDebug()<<index;
    QWidget* tab = new QWidget(ui->tabWidget);
    QLabel* label = new QLabel(tab);
    label->setText("新建的标签页_"+QString::number(index+1));
    ui->tabWidget->insertTab(index+1,tab,QString("标签页_")+QString::number(index+1));
    ui->tabWidget->setCurrentIndex(index);
}

void Widget::on_pushButton__delete_clicked()
{
    int index = ui->tabWidget->currentIndex();
    ui->tabWidget->removeTab(index);
}
